﻿'Imports System
'Imports System.Data
'Imports System.Data.OracleClient
'Imports System.Xml
'Imports System.IO
'#Region "#_Xml"
'#Region "#_List Xml file class"
'Public Class lstXmlFile
'    Inherits List(Of String)
'    Private _directory As String
'    Sub New()
'    End Sub
'    Sub New(ByVal directory As String)
'        _directory = directory
'    End Sub
'    Public ReadOnly Property directory
'        Get
'            Return _directory
'        End Get
'    End Property
'    Public Function lstXmlFile(Optional ByVal extension As String = "*.xml") As lstXmlFile
'        Dim result As New lstXmlFile
'        Try
'            Dim dir As DirectoryInfo = New DirectoryInfo(_directory)
'            Dim lstOfFile As FileInfo() = dir.GetFiles(extension)

'            For Each fi As FileInfo In lstOfFile
'                Dim file As String = fi.FullName + "<fidatetime>" + fi.Name
'                result.Add(file)
'            Next
'        Catch ex As Exception
'            appwindow.rtbLog.AppendText(vbNewLine + ex.Message)
'        End Try

'        Return result
'    End Function
'End Class
'#End Region
'#Region "#_List Xml node class"
'Public Class gXmlNode
'    Private cell_no As String
'    Private shortcode As String
'    Private moseq As String
'    Private cmdcode As String
'    Private msgbody As String
'    Private msgreceivetime As String
'    Private filedatetime As String
'    Private _fullfilename As String
'    Private _filename As String
'    Sub New(ByVal filename As String)
'        Try
'            _fullfilename = filename.Substring(0, InStr(filename, "<fidatetime>", CompareMethod.Text) - 1)
'            _filename = filename.Replace(_fullfilename + "<fidatetime>", "")

'            Application.DoEvents()
'            If appwindow.rtbLog.Text.Trim = "" Then
'                appwindow.rtbLog.AppendText("Reading..." + _fullfilename)
'            Else
'                appwindow.rtbLog.AppendText(vbNewLine + "<<<<<<<<<<<<>>>>>>>>>>>>")
'                appwindow.rtbLog.AppendText(vbNewLine + "Reading..." + _fullfilename)
'            End If

'            Dim _doc As New XmlDocument
'            _doc.Load(_fullfilename)
'            Dim nodelist As XmlNodeList

'            nodelist = _doc.GetElementsByTagName("msisdn")
'            cell_no = nodelist(0).InnerText.Trim
'            nodelist = _doc.GetElementsByTagName("shortcode")
'            shortcode = nodelist(0).InnerText.Trim
'            nodelist = _doc.GetElementsByTagName("cmdcode")
'            cmdcode = nodelist(0).InnerText.Trim
'            nodelist = _doc.GetElementsByTagName("msgbody")
'            msgbody = nodelist(0).InnerText.Trim
'            nodelist = _doc.GetElementsByTagName("moseq")
'            moseq = nodelist(0).InnerText.Trim
'            nodelist = _doc.GetElementsByTagName("sReqTime")
'            msgreceivetime = nodelist(0).InnerText.Trim
'            filedatetime = _filename.Substring(0, InStr(_filename, "_", CompareMethod.Text) - 1).Trim

'            Dim sql As String = "pk_sms_mst.pr_update_mo_hist('" + cell_no + "','" +
'                                                        shortcode + "','" +
'                                                        moseq + "','" +
'                                                        cmdcode + "','" +
'                                                        msgbody + "','" +
'                                                        msgreceivetime + "','" +
'                                                        _fullfilename.ToUpper + "','" +
'                                                        filedatetime.ToUpper + "')"

'            Dim sqlcmd As OracleCommand = New OracleCommand(sql, oradbConnection)
'            sqlcmd.CommandType = CommandType.StoredProcedure
'            sqlcmd.ExecuteNonQuery()

'            appwindow.rtbLog.AppendText("...done, " + Format(Date.Now, "yyyyMMdd HH:mm:ss"))
'            Application.DoEvents()

'            appwindow.rtbLog.AppendText(vbNewLine + "Backing up..." + _filename)

'            Dim _bkdir As String = _smsRootdir + smsSettings.mobkdir
'            _bkdir = mkDir(_bkdir)
'            Dim _todaybkdir As String = _bkdir + Format(Date.Today, "yyyyMMdd")
'            _todaybkdir = mkDir(_todaybkdir)
'            IO.File.Copy(_fullfilename, _todaybkdir + _filename, True)
'            IO.File.Delete(_fullfilename)

'            appwindow.rtbLog.AppendText("...done, " + Format(Date.Now, "yyyyMMdd HH:mm:ss"))

'        Catch ex As Exception
'            appwindow.rtbLog.AppendText("<<<<<<<<<<<<>>>>>>>>>>>>")
'            appwindow.rtbLog.AppendText(ex.Message)
'        End Try
'    End Sub
'End Class
'#End Region
'#End Region
